<?php  

namespace app\Index\controller;
use think\Controller;
use think\Request;
use think\Db;
use think\Session;

class Fankui extends Index
{
	public function fan()
	{ 

	 if (Session::get('user.phone')) {
	 	
	 	$lists = Db::name('tb_users')->where('phone',Session::get('user.phone'))->select();
        $list=$lists[0];

       $array = Request::instance()->post();
       // var_dump($array);die;
       //处理数据
        $data=['uid'=>$list['id'],
               'name'=>$list['name'],
               'fankui'=>$array['fankui'],
               'lianxi'=>$array['lianxi'],

              ];

        $result= Db::name('to_fankui')->data($data)->insert();

            if ($result >0) {
          return $this->success('回复成功',url('index/index/index'));
       }else{
          return $this->success('回复 失败');
       }

	 }else{

          return $this->success('请先登录',url('index/index/index'));
	 	
	 }
      

	}
}